import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '客服名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '联系人',
    align: "center",
    dataIndex: 'contacts'
  },
  {
    title: '联系电话',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '排序',
    align: "center",
    dataIndex: 'sort'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '客服名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入客服名称!'},
             ];
    },
  },
  {
    label: '联系人',
    field: 'contacts',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入联系人!'},
             ];
    },
  },
  {
    label: '联系电话',
    field: 'phone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入联系电话!'},
             ];
    },
  },
  {
    label: '排序',
    field: 'sort',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排序!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '客服名称',order: 0,view: 'text', type: 'string',},
  contacts: {title: '联系人',order: 1,view: 'text', type: 'string',},
  phone: {title: '联系电话',order: 2,view: 'text', type: 'string',},
  sort: {title: '排序',order: 3,view: 'number', type: 'number',},
  createTime: {title: '创建时间',order: 4,view: 'datetime', type: 'string',},
  updateTime: {title: '更新时间',order: 5,view: 'datetime', type: 'string',},
  createBy: {title: '创建人',order: 6,view: 'text', type: 'string',},
  updateBy: {title: '更新人',order: 7,view: 'text', type: 'string',},
};
